#include <iostream>
#include <algorithm>
using namespace std;

/*
    count() 统计元素出现的次数
        count(first, last, value); 
        返回值是整数类型 表示出现的次数
    count_if() 统计满足条件的元素出现的次数
        count_if(first, last, pred);
        返回值是满足pred条件的元素的个数

*/

bool isEven(int n)
{
    return n % 2 == 0;
}

int main()
{
    int a[10] = {11, 12, 23, 44, 5, 65, 74, 48, 921, 5};
    // auto num = count(a, a + 10, 5);
    auto num = count_if(a, a + 10, isEven);

    cout << "count = " << num << endl;

    return 0;
}